﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using LeadTracker.Models;
using LeadTrackerMVC.Models;

namespace LeadTrackerMVC.Controllers
{
    public class LeadController : Controller
    {
        //
        // GET: /Lead/

        public ActionResult Index()
        {
            return RedirectToAction("Dashboard", "Home");
        }

        //
        // GET: /Lead/Details/5

        public ActionResult Details(int id)
        {
            return View();
        }

        //
        // GET: /Lead/Create

        public ActionResult Create()
        {
            //var newLead = new Lead();
            //newLead.CreatedByKey = MvcApplication.UserEditorKey;
            //return View(newLead);
            return View();
        }

        //
        // POST: /Lead/Create

        [HttpPost]
        public ActionResult Create(LeadModel newLead)
        {
            MvcApplication.LeadRepository.Insert(newLead, MvcApplication.UserEditorKey);

            return RedirectToAction("Index");
        }

        //
        // GET: /Lead/Edit/5

        public ActionResult Edit(int leadId)
        {
            return View();
        }

        //
        // POST: /Lead/Edit/5

        [HttpPost]
		public ActionResult Edit(LeadModel lead)
        {
            try
            {
                // TODO: Add update logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }


    }
}
